package com.aaa.docter.controller.api;

import com.aaa.docter.service.CareHistoryService;
import com.aaa.docter.vo.HosVo;
import com.aaa.docter.vo.SchedulingVo;
import com.aaa.entity.CareHistory;
import com.aaa.entity.HisPatient;
import com.aaa.entity.Scheduling;
import com.aaa.vo.Result;
import javafx.geometry.Pos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/doctor/patient/api")
public class ApiCareHistoryController {

    /*
     * 患者库页面
     * 根据patientId查询针就诊信息 -- 三表联查
     * @param patientId
     * @return*/

    @Autowired
    private CareHistoryService careHistoryService;

    /*

    */
    @GetMapping("/ById/{patientId}")
    public Result<List<CareHistory>> list(@PathVariable String patientId) {
        return careHistoryService.getAll(patientId);
    }

    //    根据挂号单ID查询对应的病例信息
    @PostMapping("getCareHistoryByRegId/{registrationId}")
    public Result<List<CareHistory>> getCareHistoryByRegId(@PathVariable String registrationId) {
        return careHistoryService.getCareHistoryByRegId(registrationId);
    }


//保存病例
//    http://localhost:8871/doctor/patient/api/handleSaveCareHistory/GH57715016316956672
    @PostMapping("handleSaveCareHistory/{registrationId}")
    public Result handleSaveCareHistory(@PathVariable String registrationId, @RequestBody CareHistory careHistory) {

        System.out.println("registrationId ========== " + registrationId);
        return careHistoryService.handleSaveCareHistory(registrationId, careHistory);
    }


}
